# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Bartłomiej Piotrowski
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>

pkgname=jbig2dec
_commit=1d1347e38a55e657dcc4c8f1c77bb3a26bfc9ff3 # = master 2023-10-07 = v2.3
pkgver=0.20
#_gsver=gs9530
pkgrel=1
pkgdesc='Decoder implementation of the JBIG2 image compression format'
url='https://jbig2dec.com/'
arch=('loong64' 'x86_64')
license=('GPL3')
depends=('libpng' 'glibc')
makedepends=('git')
# tarball is not yet available
source=(#"https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/${_gsver}/${pkgname}-${pkgver}.tar.gz"
        "git+https://github.com/ArtifexSoftware/jbig2dec.git#commit=$_commit"
)
sha512sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^Release.//;s/\([^-]*-g\)/\1/;s/-/+/g;'
}

prepare() {
  cd ${pkgname} #-${pkgver}
#  autoreconf -vfi
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd ${pkgname} #-${pkgver}
  ./configure --prefix=/usr
  make
}

package() {
  cd ${pkgname} #-${pkgver}
  make DESTDIR="${pkgdir}" install
}
